package TestForOne;

import java.util.HashSet;
import java.util.Set;

/**
 * @author : zzr
 * @description :
 * @date :
 */
public class Test6 {
    public int findMissingNumber(int[] nums) {
        int n = nums.length;
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < n; i++) {
            set.add(nums[i]);
        }
        for (int i = 0; i < n; i++) {
            if ( !set.contains(nums[i])) {
                return nums[i];
            }
        }
        return -1;
    }
}
